package wrap.pages;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * HealthTopics.java
 *
 * Created on Nov 21, 2009, 12:23:39 PM
 */

/**
 *
 * @author Lazlo
 */

import wrap.core.*;

public class Numerology extends javax.swing.JPanel {

    /** Creates new form HealthTopics */
    public Numerology() {
        initComponents();

        java.util.Map<String,Integer>  months=new java.util.HashMap<String,Integer>();

               months.put("Jan", new Integer(1));
        months.put("Feb", new Integer(2));
        months.put("Mar", new Integer(3));
        months.put("Apr", new Integer(4));
        months.put("May", new Integer(5));
        months.put("Jun", new Integer(6));
        months.put("Jul", new Integer(7));
        months.put("Aug", new Integer(8));
        months.put("Sep", new Integer(9));
        months.put("Oct", new Integer(10));
        months.put("Nov", new Integer(11));
        months.put("Dep", new Integer(12));

        java.util.Map numerology = new java.util.HashMap<Integer,Object>();


        String[] path1 = {"You are ambitious and assertive in promoting yourself.",
                            "Although you may hide the fact for social reasons,",
                            "you can be self-centered and demand to have your way in many circumstances.",
                            "That said, for the most part, you are considered very good company, friendly,",
                            "good-natured, and a wonderful conversationalist."
                            };

        String[] path2 = {"In many ways, you are a creature of habit and routine, ",
                            "and you like your path and pattern well worn and familiar.",
                            "Your ability to analyze and render accurate judgments is a wonderful ",
                            "natural trait you bring to the business world. You strive for complete ",
                            "accuracy and even perfection in your work."
                        };

        String path3[] = {"accuracy and even perfection in your work.",
                            "You are not very good at handling money ",
                            "You spend it when you have it and don't when you don't.",
                            "The 3 loves connecting with people. ",
                            "The approach to life tends to be exceedingly positive"
                            };

        String path4[] = {"You are an excellent organizer and planner",
                            "Loyal and devoted, you make the best of your marriage",
                            "You are one of the most dependable people you know.",
                            "Often, you are called on to take care of others",
                            "You are a builder of society. "
                        };


        String path5[] = {"The most freedom-loving and compassionate Life Path.",
                            "A great Life Path 5 American President, Abraham Lincoln,  ",
                            "issued the Emancipation Proclamation,and ended slavery in America",
                            "You are a good communicator, and you know how to motivate people around you.",
                            "A love of adventure may dominate your life. "
                        };

        String path6[] = {"You are idealistic and must feel useful to be happy.",
                            "You are a humanitarian of the first order.",
                            "It is your role to serve others.",
                            "This is the Life Path related to leadership.",
                            "You are a sympathetic and kind person."
                        };
        String path7[] = {"You actually like being alone and away from the hustle and bustle",
                            "A Life Path 7 person is a peaceful and affectionate soul. ",
                            "It takes time for you to warm up to new friends",
                            "You rely heavily on your experiences and your intuition",
                            "Adaptability is not your style, and change for you is a rarity."
                        };

        String path8[] = {"You know how to manage yourself and your environment.",
                            "This Life Path is the most prone to producing workaholics.",
                            "Focused on learning the satisfactions to be found in the material world.",
                            "Most concerned with and desirous of status as an ultimate measure of success.",
                            "You were born to be an executive."
                        };

        String path9[] = {"Usually this number produces an individual that is very trustworthy and honorable.",
                            "Material gains are not overly important",
                            "You have the ability to make friends very easily",
                            "You tend to be quite sensitive, as you see the world with much feeling",
                            "The purpose of life for those with a 9 life path is often of a philosophical nature"
                        };

        numerology.put(1, path1);
        numerology.put(2, path2);
        numerology.put(3, path3);
        numerology.put(4, path4);
        numerology.put(5, path5);
        numerology.put(6, path6);
        numerology.put(7, path7);
        numerology.put(8, path8);
        numerology.put(9, path9);

//        test_printPath (path1);
//        test_printPath (path2);
//        test_printPath (path3);
//        test_printPath (path4);
//        test_printPath (path5);
//        test_printPath (path6);
//        test_printPath (path7);
//        test_printPath (path8);
//        test_printPath (path9);



        String mn =(String)CC.getValues().get("Month");
        int dy = Integer.parseInt((String)CC.getValues().get("Day"));
        int yr = Integer.parseInt((String)CC.getValues().get("Year"));

        System.out.println("Your Life Path is::"+ getPath(yr + dy + months.get(mn)));
        pth = getPath(yr + dy + months.get(mn));
        jLabel5.setText("Your Life Path is::"+ pth);

        String[] text = (String[])numerology.get(pth);

        jLabel7.setText(text[0]);
        jLabel8.setText(text[1]);
        jLabel9.setText(text[2]);
        jLabel10.setText(text[3]);
        jLabel11.setText(text[4]);
    }
    
    int pth;

    public String getSoundName(){
        return "numerology/" + String.valueOf(pth);
    }

    int getPath(int in)
    {
        int sum=0;
        String temp = Integer.toString(in);
        int length = temp.length();
        String c;
        Boolean flag =false;
        while(temp.length()>1)
        {
            flag=true;
            sum=0;
            length = temp.length();
            for (int i=0; i< length;i++)
            {
                c=temp.substring(i, i+1);
                sum += Integer.parseInt(c);
            }
            System.out.println("The Value is::" + sum);
            temp=Integer.toString(sum);

        }
        if(!flag)
        {
           sum = in;
        }

        return sum;
    }

    private void test_printPath (String[] path){
        System.out.println();
        System.out.println("PATH:");
        for(int i = 0; i < path.length; i++){
            System.out.print(path[i]);
        }
    }


    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jPanel1 = new javax.swing.JPanel();
        jButton3 = new javax.swing.JButton();
        jButton4 = new javax.swing.JButton();
        jPanel5 = new javax.swing.JPanel();
        jButton2 = new javax.swing.JButton();
        jPanel2 = new javax.swing.JPanel();
        jButton1 = new javax.swing.JButton();
        jPanel3 = new javax.swing.JPanel();
        jPanel4 = new javax.swing.JPanel();
        jLabel3 = new javax.swing.JLabel();
        jPanel7 = new javax.swing.JPanel();
        jLabel5 = new javax.swing.JLabel();
        jLabel6 = new javax.swing.JLabel();
        jLabel7 = new javax.swing.JLabel();
        jLabel8 = new javax.swing.JLabel();
        jLabel9 = new javax.swing.JLabel();
        jLabel10 = new javax.swing.JLabel();
        jLabel11 = new javax.swing.JLabel();
        jLabel12 = new javax.swing.JLabel();

        setLayout(new java.awt.BorderLayout());

        jPanel1.setLayout(new java.awt.BorderLayout());

        jButton3.setIcon(new javax.swing.ImageIcon(getClass().getResource("/wrap/sounds/sound.png"))); // NOI18N
        jButton3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton3ActionPerformed(evt);
            }
        });
        jPanel1.add(jButton3, java.awt.BorderLayout.LINE_END);

        jButton4.setText("Back");
        jButton4.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton4ActionPerformed(evt);
            }
        });
        jPanel1.add(jButton4, java.awt.BorderLayout.LINE_START);

        jPanel5.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.CENTER, 0, 15));

        jButton2.setText("Show All Topics");
        jButton2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton2ActionPerformed(evt);
            }
        });
        jPanel5.add(jButton2);

        jPanel1.add(jPanel5, java.awt.BorderLayout.CENTER);

        add(jPanel1, java.awt.BorderLayout.PAGE_START);

        jButton1.setText("Back To Topic Selection");
        jButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton1ActionPerformed(evt);
            }
        });
        jPanel2.add(jButton1);

        add(jPanel2, java.awt.BorderLayout.PAGE_END);

        jPanel3.setLayout(new java.awt.BorderLayout());

        jPanel4.setLayout(new java.awt.GridLayout(3, 1));

        jLabel3.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabel3.setText("NUMEROLOGY");
        jPanel4.add(jLabel3);

        jPanel7.setLayout(new java.awt.GridLayout(8, 1));

        jLabel5.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabel5.setText("jLabel5");
        jPanel7.add(jLabel5);

        jLabel6.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jPanel7.add(jLabel6);

        jLabel7.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jPanel7.add(jLabel7);

        jLabel8.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jPanel7.add(jLabel8);

        jLabel9.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jPanel7.add(jLabel9);

        jLabel10.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jPanel7.add(jLabel10);

        jLabel11.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jPanel7.add(jLabel11);

        jLabel12.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jPanel7.add(jLabel12);

        jPanel4.add(jPanel7);

        jPanel3.add(jPanel4, java.awt.BorderLayout.CENTER);

        add(jPanel3, java.awt.BorderLayout.CENTER);
    }// </editor-fold>//GEN-END:initComponents

    private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton4ActionPerformed
        // TODO add your handling code here:
        CC.back();
    }//GEN-LAST:event_jButton4ActionPerformed

    private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed
        // TODO add your handling code here:
                CC.playPageSound();

    }//GEN-LAST:event_jButton3ActionPerformed

    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
        // TODO add your handling code here:
        CC.to("Topic");
    }//GEN-LAST:event_jButton1ActionPerformed

    private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
        // TODO add your handling code here:
                CC.to("Contents");
}//GEN-LAST:event_jButton2ActionPerformed


    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton jButton1;
    private javax.swing.JButton jButton2;
    private javax.swing.JButton jButton3;
    private javax.swing.JButton jButton4;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel12;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JPanel jPanel4;
    private javax.swing.JPanel jPanel5;
    private javax.swing.JPanel jPanel7;
    // End of variables declaration//GEN-END:variables

}
